package com.drops.utils;

import com.drops.ui.MainController;

import java.io.IOException;
import java.net.Socket;

/**
 * @ClassName: LDAPUtil
 * @Description: TODO
 * @Author: Summer
 * @Date: 2021/8/2 10:01
 * @Version: v1.0.0
 * @Description: 检测1389端口是否被占用
 **/
public class LDAPUtil {
    final MainController mainController;

    public LDAPUtil(MainController mainController) {

        this.mainController = mainController;
    }

   public boolean sendLDAPRequest(String target) {
        String host = URLUtil.getHost(target);
        try {
            System.out.println("查看 "+ 1389);
            new Socket(host, 1389);
//            this.mainController.logTextArea.appendText(Utils.log(host + " 1389 端口被占用! "  ));
            return false;
        } catch (IOException e) {
//            this.mainController.logTextArea.appendText(Utils.log("LDAP Server "));
            return true;
        }
    }


}
